stopword

对常见的单词进行限制, 进行过滤

以NLTK 为基础

class MyClassifier(NLTKClassifier): nltk_class = nltk.classify.svm.SvmClassifier

自带分类器

TextBlob 包进一步进行情感分析

from textblob import TextBlob from textblob.classifiers import NaiveBayesClassifier train = [ ... ('I love this sandwich.', 'pos'), ... ('This is an amazing place!', 'pos'), ... ('I feel very good about these beers.', 'pos'), ... ('I do not like this restaurant', 'neg'), ... ('I am tired of this stuff.', 'neg'), ... ("I can't deal with this", 'neg'), ... ("My boss is horrible.", "neg") ... ] cl = NaiveBayesClassifier(train) cl.classify("I feel amazing!") 'pos' blob = TextBlob("The beer is good. But the hangover is horrible.", classifier=cl) for s in blob.sentences: ... print(s) ... print(s.classify()) ... The beer is good. pos But the hangover is horrible. neg

results matching ""

    No results matching ""